<template>
	<view class="pagebody" :style="{ height: maxHeight }">
		<view class="logo flex-row justify-center">
			<image style="width:152rpx;height:152rpx;" src="@/static/images/login/logo.png" alt=""></image>
		</view>

		<view class="colorfff justify-center"
			style="font-size: 30rpx;margin-top: 62rpx;display: flex; justify-content: center;">
			药 队 长 ，全 球 寻 药 ，健 康 随 行 ！
		</view>
		<view class=" align-center botbox flex-col" style="">
			<button class="button" type="primary" @click="towxlogin">
				<image style="width: 50rpx;
			height: 42rpx;
			margin-right: 32rpx;" src="@/static/images/login/wxlogo.png" alt=""></image> 微信登录
			</button>
			<navigator style="font-size: 30rpx;color: #FFFFFF;margin-top: 56rpx
			;" url="/pages/login/phonelogin">其它方式登录</navigator>
			

			<view style="margin-top: 78rpx; color: #FFFFFF;" class="fz26 flex-row align-center">
				<checkbox-group @change="changebox">
					<label>
						<checkbox value="cb" color="#FFCC33" style="transform:scale(0.7)" />
					</label>
				</checkbox-group>
				同意<span style="color: #00D9B2;margin: 0 16rpx;">用户协议</span>和<span
					style="color: #00D9B2;margin: 0 16rpx;">隐私政策</span>
			</view>
			
			<!-- 登录写完后删除掉 -->
			<navigator style="font-size: 30rpx;color: #FFFFFF;margin-top: 20rpx
			;position: fixed;bottom: 46px;" url="/pages/home">HOME</navigator>
			<!-- 登录写完后删除掉 -->
		</view>
		<u-popup v-model="show" mode="bottom" border-radius="30">
			<view class="popupbox">
				<view class=" justify-center color303b39 fz36 fwbold">
					请阅读并同意以下条款
				</view>
				<view class="justify-center fz32" style="color: #50A495; font-weight: 500;margin-top: 80rpx;">
					<span @click="toyspage(1)" style="margin-right: 56rpx;">《 用户协议 》</span><span @click="toyspage(2)">《 隐私政策 》</span>
				</view>
				<view @click="wxlogin" class="justify-center align-center fz32 colorfff"
					style="margin-top: 56rpx;height: 100rpx; background-color: #00D9B2; border-radius: 98rpx;">
					同意并继续
				</view>
				<view @click="show = false" class="justify-center align-center fz32 color303b39"
					style="margin-top: 40rpx;border: 1px solid #B8C3C1;height: 100rpx; background-color: #fff; border-radius: 98rpx;">
					拒绝
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		onLoad() {
			// 获得屏幕最大高度
			let systemInfo = uni.getSystemInfoSync();
			this.maxHeight = systemInfo.windowHeight + "px";
		},
		data() {
			return {
				maxHeight: '',
				selectedFruits: ['apple'],
				agree: false,
				show: false,
			}
		},
		methods: {
			towxlogin: function(e) {
				if (this.agree == false) {
					// 弹出底部提示框 提示用户同意并继续
					this.show = true
				} else {
					this.wxlogin()
				}
			},
			toyspage(typeid){
				uni.navigateTo({ url:'/pages/mine/privacy/index?typeid='+typeid });
			},
			changebox(e) {

				if (e.detail.value.length > 0) {
					this.agree = true
				} else {
					this.agree = false
				}
			},
			wxlogin() {
				this.show = false
				uni.showLoading({
					title: '跳转中，请稍后...'
				})
				setTimeout(() => {
					uni.hideLoading();
					uni.navigateTo({
						url: '/pages/login/setarea',
						animationType: 'pop-in',
						animationDuration: 200
					})
				}, 1000)
			}
		}
	};
</script>

<style lang="scss" scoped>
	::v-deep uni-checkbox .uni-checkbox-input {
		background: transparent;
	}

	::v-deep uni-checkbox {
		-webkit-appearance: none;
	}

	::v-deep uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
		color: #fff;
		border-color: #00D9B2;
		background: #00D9B2;

	}

	// page {
	// 	background-image: url('/static/images/login/loginbg.png');
	// 	position: relative;
	// 	background-repeat: no-repeat;
	// 	background-size: cover;
	// 	width: 100vw;
	// }

	.pagebody {
		overflow: hidden;
		background-image: url('/static/images/login/loginbg.png');
		background-repeat: no-repeat;
		background-size: cover;

		.logo {
			margin-top: 244rpx;

			img {
				width: 152rpx;
			}
		}

		.botbox {
			position: absolute;
			bottom: 10%;
			display: flex;
			width: -webkit-fill-available;

			uni-button {
				background-color: #00D9B2;
				border-radius: 98rpx;
				width: 668rpx;
			}

			uni-button:after {
				border: none;
			}

			.button {
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 36rpx;

			}
		}

		.popupbox {
			box-sizing: border-box;
			padding: 48rpx 41rpx 80rpx;
		}

	}
</style>